package com.lfg.leetcode.leetcode500;

public class No518change {
    public static void main(String[] args) {
        int ret = change(5, new int[]{1, 2, 5});
        System.out.println("[" + ret + "]");

    }


    public static int change(int amount, int[] coins) {
        int[] dp = new int[amount + 1];
        dp[0] = 1;
        for (int c : coins) {
            for (int i = c; i <= amount; i++) {
                int index = i - c;
                dp[i] += dp[index];
            }
        }
        return dp[amount];
    }
}
